package com.wxzz.elearing.livetelecast.api.admin;


import com.wxzz.elearing.livetelecast.dto.*;
import com.wxzz.elearing.livetelecast.entity.PlatformLivetelecast;
import com.wxzz.elearing.livetelecast.entity.WxUserPlatformLivetelecast;
import com.wxzz.elearing.livetelecast.service.IPlatformLivetelecastService;
import com.wxzz.elearing.livetelecast.service.IWxUserPlatformLivetelecastService;
import com.wxzz.elearing.livetelecast.vo.PlatformLivetelecastStatisticsVo;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.http.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import retrofit2.http.Multipart;
import retrofit2.http.Path;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 平台直播 前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-02
 */
@RestController
@RequestMapping("/platform-livetelecast")
@Api(tags = "平台直播(总后台)")
public class PlatformLivetelecastController {

    @Autowired
    private IPlatformLivetelecastService platformLivetelecastService;

    @Autowired
    private IWxUserPlatformLivetelecastService wxUserPlatformLivetelecastService;


    @ApiOperation(value = "新增平台直播(总后台)", notes = "新增或修改直播分类(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "savePlatformLivetelecast", method = RequestMethod.POST)
    public ReturnVO savePlatformLivetelecast(@RequestBody PlatformLivetelecast platformLivetelecast) {
        return platformLivetelecastService.savePlatformLivetelecast(platformLivetelecast);
    }

    @ApiOperation(value = "修改平台直播(总后台)", notes = "修改平台直播(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "updatePlatformLivetelecast", method = RequestMethod.POST)
    public ReturnVO updatePlatformLivetelecast(@RequestBody PlatformLivetelecast platformLivetelecast) {
        return platformLivetelecastService.updatePlatformLivetelecast(platformLivetelecast);
    }

    @ApiOperation(value = "平台直播列表(总后台)", notes = "平台直播列表(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listPlatformLivetelecast", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<PlatformLivetelecast>>> listPlatformLivetelecast(@RequestBody PlatformLivetelecastDto platformLivetelecastDto) {
        return platformLivetelecastService.listPlatformLivetelecast(platformLivetelecastDto);
    }

    @ApiOperation(value = "平台直播详情(总后台)", notes = "平台直播详情(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "selectPlatformLivetelecastDetail/{platformLivetelecastId}", method = RequestMethod.POST)
    public ReturnVO<PlatformLivetelecast> selectPlatformLivetelecastDetail(@PathVariable Long platformLivetelecastId) {
        return platformLivetelecastService.selectPlatformLivetelecastDetail(platformLivetelecastId);
    }

    @ApiOperation(value = "删除直播(总后台)", notes = "删除直播(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "deletePlatformLivetelecast/{platformLivetelecastId}", method = RequestMethod.POST)
    public ReturnVO deletePlatformLivetelecast(@PathVariable Long platformLivetelecastId) {
        return platformLivetelecastService.deletePlatformLivetelecast(platformLivetelecastId);
    }

    @ApiOperation(value = "直播预约列表(总后台)", notes = "平台直播详情(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listWxUserPlatformLivetelecast", method = RequestMethod.POST)
    public ReturnVO<List<JgPageVo<WxUserPlatformLivetelecast>>> listWxUserPlatformLivetelecast(@Valid @RequestBody WxUserPlatformLivetelecastDto wxUserPlatformLivetelecastDto) {
        return wxUserPlatformLivetelecastService.listWxUserPlatformLivetelecast(wxUserPlatformLivetelecastDto);
    }

    @ApiOperation(value = "直播观看列表(总后台)", notes = "直播观看列表(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "selectWatchPlatformLivetelecast", method = RequestMethod.POST)
    public ReturnVO<List<JgPageVo<WxUserPlatformLivetelecast>>> selectWatchPlatformLivetelecast(@Valid @RequestBody WxUserPlatformLivetelecastDto wxUserPlatformLivetelecastDto) {
        return wxUserPlatformLivetelecastService.selectWatchPlatformLivetelecast(wxUserPlatformLivetelecastDto);
    }


    @ApiOperation(value = "请求上传媒资(返回上传url)(总后台)", notes = "请求上传媒资(返回上传url)(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "sendVodFile/{platformLivetelecastId}", method = RequestMethod.POST)
    public ReturnVO sendVodFile(@ApiParam("直播id") @PathVariable Long platformLivetelecastId) {
        return platformLivetelecastService.sendVodFile(platformLivetelecastId);
    }

    @ApiOperation(value = "确认上传成功(总后台)", notes = "确认上传成功(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "confirmSend/{assetId}", method = RequestMethod.POST)
    public ReturnVO confirmSend(@ApiParam("媒资id") @PathVariable String assetId) {
        return platformLivetelecastService.confirmSend(assetId);
    }

    @ApiOperation(value = "直播邀请排行榜(总后台)", notes = "直播邀请排行榜(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "adminListInvitedWxUser", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<WxUserPlatformLivetelecast>>> adminListInvitedWxUser(@RequestBody AdminListInvitedWxUserDto adminListInvitedWxUserDto) {
        return wxUserPlatformLivetelecastService.adminListInvitedWxUser(adminListInvitedWxUserDto);
    }

    @ApiOperation(value = "查询该用户的邀请人员(总后台)", notes = "查询该用户的邀请人员(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "listInvitedWxUser", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<WxUserPlatformLivetelecast>>> listInvitedWxUser(@RequestBody InvitedWxUserDto invitedWxUserDto) {
        return wxUserPlatformLivetelecastService.listInvitedWxUser(invitedWxUserDto);
    }

    @ApiOperation(value = "查询该直播对应的统计数据(总后台)", notes = "查询该直播对应的统计数据(总后台)", httpMethod = "POST", tags = "总后台")
    @RequestMapping(value = "selectPlatformLivetelecastStatisticsVo/{platformLivetelecastId}", method = RequestMethod.POST)
    public ReturnVO<PlatformLivetelecastStatisticsVo> selectPlatformLivetelecastStatisticsVo(@PathVariable Long platformLivetelecastId) {
        return platformLivetelecastService.selectPlatformLivetelecastStatisticsVo(platformLivetelecastId);
    }


}
